package main

import (
	"fmt"

	"aiplus.times/localdns/internal"
	"github.com/gin-gonic/gin"
)

func main() {
	r := gin.Default()

	// 定义路由
	r.GET("/hosts", internal.GetHosts)
	r.POST("/hosts", internal.AddHost)
	r.PUT("/hosts/:index", internal.UpdateHost)
	r.DELETE("/hosts/:index", internal.DeleteHost)

	// 启动服务
	fmt.Println("Server started on :8080")
	if err := r.Run(":8080"); err != nil {
		fmt.Println("Failed to start server:", err)
	}
}
